<template>
    <div class="main-box" @click="toPages($event)">
        <header>
            <div class="head">
                <img :src="baseURL + user.photo" alt="">
                <p class="name">{{ user.name }}</p>
            </div>
            <ul class="mylist">
                <li class="integral">
                    <div>12345分</div>
                    <div>用户积分</div>
                </li>
                <li class="balance">
                    <div>￥188.00</div>
                    <div>账户余额</div>
                </li>
                <li class="coupon">
                    <div>2张</div>
                    <div>优惠券</div>
                </li>
            </ul>
        </header>
        <main>
            <van-cell-group class="myDD">
                <h3>
                    <van-cell class="myorder" title="我的订单" is-link list @click="router.push('/myorder')"/>
                </h3>
                <ul class="operate">
                    <li><i class="icon iconfont icon-a-ziyuan8 list"></i><span class="list">已完成</span></li>
                    <li><i class="icon iconfont icon-a-ziyuan5 list"></i><span class="list">待付款</span></li>
                    <li class="addr"><i class="icon iconfont icon-a-ziyuan8 addr" @click="router.push('/address')"></i><span>地址</span></li>
                    <li><i class="icon iconfont icon-a-ziyuan7"></i><span class="list">待评价</span></li>
                </ul>
            </van-cell-group>
            <van-cell-group class="group2">
                <van-cell icon="location-o" class="lii security" title="账户安全" is-link />
                <van-cell icon="location-o" class="lii mycard" title="我的会员卡" is-link />
                <van-cell icon="location-o" class="lii myset" title="设置中心" is-link />
            </van-cell-group>
            <van-cell-group class="group3">
                <!-- <i class="icon iconfont icon-a-ziyuan30"></i> -->
                <van-cell icon="location-o" class="lii aboutus" title="关于我们" is-link />
                <van-cell icon="location-o" class="lii callus" title="联系我们" is-link />
            </van-cell-group>
        </main>
    </div>
</template>

<script lang="ts" setup>
import { useRouter } from "vue-router";
import { useCommonStore } from "../../store";
const baseURL = window.baseURL;
// const data = {
//     name: 'lisannnnnn'
// }
const router = useRouter()
const user = useCommonStore().userInfo


/** 点击跳转方法 */
function toPages(e:any){
    //跳转到地址
    //如果点击的是图标
    const reg = RegExp(/addr/)
    if(reg.test(e.target.className)){
        router.push('/address')
        return
    }
    // 跳转订单
    const regList = RegExp(/list/)
    if(regList.test(e.target.className)){
        router.push('/myorder')
        return
    }
    // //跳转到点击tab的path路径
    // console.log(e.target.innerHTML);
    // console.log(e.target.className);
    
    // let clc = eles.value.filter((it:any)=>{
    //     return it.txt === e.target.innerHTML
    // })
    // if(clc.length!=0){
    //     console.log(clc[0].path);
    //     router.push(clc[0].path)
    // }
}
</script>

<style lang="less" scoped>

@import "../../style/comon.less";
.main-box{
    .rel(){}
    flex-direction: column;
    @headH: 11rem;
    @h: 50px;
    @p: .8rem;
    header{
        height: @headH;
        width: 100%;
        background-color: #83da68ed;
        text-align: center;
        .head{
            height: 60%;
            padding: .8rem 0;
            img{
                width: 90px;
                margin: 4px auto 0px;
            }
            .name{
                font-size: 16px;
                color: @g1;
                line-height: 1.2rem;
            }
        }
        .mylist{
            display: flex;
            justify-content: space-around;
            align-items: center;
            li{
                margin-top: 28px;
                font-size: .7rem;
                color: @g1;
                line-height: 25px;
            }
        }
    }
    main{
        height: calc(calc(100vh - @headH) - @h);
        background-color: @g1;
        .myDD{
            background-color: #fff;
            height: 120px;
            .operate{
                display: flex;
                justify-content: space-around;
                align-items: center;
                height: calc(120px - 44px);
                font-size: .6rem;
                li{
                    margin-top: 10px;
                    line-height: 25px;
                    height: 40px;
                    flex: 1;
                    text-align: center;
                    // background-color: orange;
                    border-right: 1px solid #ccc;
                    display: flex;
                    flex-direction: column;
                    justify-content: center;
                    i{
                        font-size: 20px;
                    }
                }
            }
        }
        .van-cell{
            border-bottom: 1px solid #ccc;
        }
        .group2{
            margin: 10px auto;
            .van-cell{
                &:nth-child(3){
                    border-bottom: none;
                }
            }
            
        }
        .group3{
            .van-cell{
                &:nth-child(2){
                    border-bottom: none;
                }
            }
        }
    }
}

</style>